package basic.util;

public class VariableArgs {
	public static String[] parseToStrings(Object ... args){
		if(args==null){
			return null;
		}
		int arg_count = args.length;
		String[] retStrings = new String[arg_count];
		for(int i=0;i<arg_count;i++){
			retStrings[i] = args[i].toString();
		}
		return retStrings;
	}
	
	public static String parseToLongString(Object ... args){
		String[] ret = parseToStrings(args);
		if(ret==null)
			return null;
		StringBuffer retBuffer = new StringBuffer();
		for(int i=0;i<ret.length-1;i++){
			retBuffer.append(ret[i]+",");
		}
		retBuffer.append(ret[ret.length-1]);
		return retBuffer.toString();
	}
	
	public static void main(String[] args) {
		System.out.println(parseToLongString("haha",1,34,23423.2342));
	}
}
